package com.woniuxy.controller;

import com.woniuxy.entity.utils.ResponseEntity;
import com.woniuxy.service.OrderService;
import com.woniuxy.service.OrderServiceByProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @Description  则是order启动类
 * @Author jresm骏
 * @Date 2022/12/5 23:02
 **/

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    OrderService orderService;
    @Autowired
    OrderServiceByProduct orderServiceByProduct;
    @PostMapping("/{pid}/{num}")
    public ResponseEntity generateOrder(@PathVariable Integer pid,@PathVariable Integer num){
        return orderService.generateOrder(pid,num);
    }
    @GetMapping("/{name}/{minPrice}/{maxPrice}")
    public ResponseEntity findProductList(@PathVariable String name,@PathVariable double minPrice,@PathVariable double maxPrice){
        return orderServiceByProduct.findProductList(name,minPrice,maxPrice);
    }
}
